//
//  MainMessageIndexTableViewCell.swift
//  BusinessIOS
//
//  Created by Rain on 2019/1/9.
//  Copyright © 2019 XingJian Li. All rights reserved.
//

import UIKit

class MainMessageIndexTableViewCell: UITableViewCell {
   
    
    var nameLabel:UILabel!
    
     var timeLabel:UILabel!
    
     var messageLabel:UILabel!
    
    required init?(coder aDecoder: NSCoder) {
        
        super.init(coder: aDecoder)
        
    }
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.lauoutUI()
        
    }
    
    // 赋值方法 - 显示 cell 内容方法
    func MainMessageIndexTableViewCell(model: MainMessageModel) {
        
        
      
        nameLabel.text = "督办消息"
        
        timeLabel.text = model.createTime
        
        messageLabel.text = model.MainMessage
        
        
    }
    
    
    func lauoutUI() {
        
   
        
        self.nameLabel = UILabel()
        
        self.nameLabel.text = "风雨"
        self.nameLabel.textAlignment = .left
        
        self.nameLabel.textColor = UIColor.black
        
        self.nameLabel.font = UIFont.systemFont(ofSize:15)//一般方法
        
        
        self.contentView.addSubview(self.nameLabel)
        
        self.timeLabel = UILabel()
        
        self.timeLabel.text = "201800108"
        self.timeLabel.textAlignment = .right
        
        self.timeLabel.textColor = UIColor.gray
        
        self.timeLabel.font = UIFont.systemFont(ofSize:15)//一般方法
        self.contentView.addSubview(self.timeLabel)
        
        self.messageLabel = UILabel()
        
        self.messageLabel.text = "哈哈消息"
        self.messageLabel.textAlignment = .left
        
        self.messageLabel.textColor = UIColor.gray
        
        self.messageLabel.font = UIFont.systemFont(ofSize:15)//一般方法
        self.contentView.addSubview(self.messageLabel)
      
        
    }
    
    override func layoutSubviews() {
        
        super.layoutSubviews()
        
     
        
        self.nameLabel.frame = CGRect(x: 10, y: 0, width: self.frame.size.width/2 - 20 , height: 20)
        
        self.timeLabel.frame = CGRect(x: self.frame.size.width/2 + 10, y: 0, width: self.frame.size.width/2 - 10 - 10, height: 20)
        
        self.messageLabel.frame = CGRect(x: 10, y: 20, width: self.frame.size.width - 10, height: 20)
        
        
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
